Skip to content

Add NURBS #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add NURBS #24

wants to merge 2 commits into from

Conversation

SouthEndMusic
Copy link
Member

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Fixes #16

@ChrisRackauckas
Copy link
Member

What is NURBS? Can you link a paper? Maybe in a docstring as well?

Comment on lines +8 to +10
abstract type AbstractGlobalCache end

struct TrivialGlobalCache <: AbstractGlobalCache end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why a global cache instead of a function-local cache?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache is local to an interpolation object, it's global in the sense that it is not associated with a particular input dimension. There might be a better name for it.

@@ -56,6 +80,13 @@ function get_output_size(interp::NDInterpolation{N_in}) where {N_in}
size(interp.u)[(N_in + 1):end]
end

make_zero(::T) where {T <: Number} = zero(T)

function make_zero(v::T) where {T <: AbstractArray}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function make_zero(v::T) where {T <: AbstractArray}
function make_zero!!(v::T) where {T <: AbstractArray}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this mean? That some methods are mutating and some aren't?

@SouthEndMusic
Copy link
Member Author

SouthEndMusic commented May 13, 2025

NURBS stands for Non-Uniform Rational Basis Spline. It's a generalization of B-Spline geometries, where a weight is associated with each control point which determines how relatively attractive the control point is. When all weights are the same, the geometry reduces to a B-spline. NURBS are apparently popular in CAD.

The weights are used to construct piecewise rational weight functions for the control points, hence the R (which also makes analytical derivatives a pain). Using the weights certain shapes can be represented exactly which can only be approximated by B-Splines, for instance a circle (which is why I use that in a unit test).

The Wikipedia page does a pretty good job of introducing the concept, but the go-to source for this subject is The NURBS book.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NURBS
2 participants